﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MyVoteMVC.Domain
{
    public class VT_Activities
    {
        public VT_Activities()
        {
            ChildActivities = new List<VT_Activities>();
            Messages = new List<VT_Messages>();
            Questions = new List<VT_Questions>();
            Tickets = new List<VT_Tickets>();
        }
        /// <summary>
        /// PK Guid
        /// </summary>
        public string Activity_ID { get; set; }

        /// <summary>
        /// 用于记录二轮活动的父活动ID
        /// </summary>
        public string Activity_PID { get; set; }

        /// <summary>
        /// 自编序号，用于显示
        /// </summary>
        public string Activity_No { get; set; }

        /// <summary>
        /// 活动标题
        /// </summary>
        public string Activity_Title { get; set; }

        /// <summary>
        /// 活动描述
        /// </summary>
        public string Activity_Content { get; set; }

        /// <summary>
        /// 活动开始时间
        /// </summary>
        public DateTime? Activity_StartTime { get; set; }

        /// <summary>
        /// 活动结束时间
        /// </summary>
        public DateTime? Activity_EndTime { get; set; }

        /// <summary>
        /// 活动投票详细结果是否显示用户名
        /// </summary>
        public int? Activity_IfShowUser { get; set; }

        public string Activity_IfShowUserText 
        { 
            get 
            {
                return (Activity_IfShowUser.Value == 1 ? "是" : "否");
            } 
        }

        /// <summary>
        /// 活动投票详细是否完全显示（或只显示当前用户的票）
        /// 2011-12-10 标识活动是否全部Item关联自Project
        /// </summary>
        public int? Activity_IfReadAll { get; set; }

        public string Activity_IfReadAllText
        {
            get
            {
                return (Activity_IfReadAll.Value == 1 ? "是" : "否");
            }
        }

        /// <summary>
        /// 活动是否单人支持多次投票
        /// </summary>
        public int? Activity_IfMultiSubmit { get; set; }

        public string Activity_IfMultiSubmitText
        {
            get
            {
                return (Activity_IfMultiSubmit.Value == 1 ? "是" : "否");
            }
        }
        /// <summary>
        /// 创建人（姓名）
        /// </summary>
        public string Created_By { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? Created_Date { get; set; }

        /// <summary>
        /// 创建使用方法
        /// </summary>
        public string Created_Action { get; set; }

        /// <summary>
        /// 最后更新人（姓名）
        /// </summary>
        public string Last_Update_By { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime? Last_Update_Date { get; set; }

        /// <summary>
        /// 更新使用方法
        /// </summary>
        public string Last_Update_Action { get; set; }

        /// <summary>
        /// 活动打开次数
        /// </summary>
        public int? View_Count { get; set; }
        public string Memo { get; set; }

        //LazyLoad
        /// <summary>
        /// 相关父活动
        /// </summary>
        public virtual VT_Activities ParentActivity { get; set; }

        /// <summary>
        /// 相关子活动
        /// </summary>
        public virtual ICollection<VT_Activities> ChildActivities { get; set; }

        /// <summary>
        /// 相关消息
        /// </summary>
        public virtual ICollection<VT_Messages> Messages { get; set; }

        /// <summary>
        /// 相关问题
        /// </summary>
        public virtual ICollection<VT_Questions> Questions { get; set; }

        /// <summary>
        /// 相关票据
        /// </summary>
        public virtual ICollection<VT_Tickets> Tickets { get; set; }

        /// <summary>
        /// 相关头像
        /// </summary>
        public virtual VT_ActivityImage ActivityImage { get; set; }

    }

    public class VT_ActivityImage
    {
        public VT_ActivityImage()
        {
          
        }

        /// <summary>
        /// PK Guid
        /// </summary>
        [Key]
        public string Activity_ID { get; set; }

        /// <summary>
        /// 活动头像
        /// </summary>
        public byte[] Activity_Image { get; set; }
    }
}
